#ifndef PSEGYVIEW_H
#define PSEGYVIEW_H

#include <QMainWindow>
#include <QAction>
#include <QToolBar>
#include <plot/paintpsegy.h>
#include <QtGui>
#include <config/common.h>
#include <form/channel.h>
#include <config/config.h>

class PSegyView : public QMainWindow
{
    Q_OBJECT

public:
    explicit PSegyView(QWidget *parent = 0);
    ~PSegyView();
    void createActions();
    void createMenus();
    void createToolBars();
    void createStatusBar();
    void dofft();


    int edge_function(int x, int xsize);
    QVector<QPointF> DWT(double c[], double d[], int pointNum);
    float CorrDWT(QVector<QPointF> p1, QVector<QPointF> p2);
    QVector<QPointF> timeMaxDWT(QVector<QPointF> p);
    void timeMax();
    void wholeWavecorr();
    float arraySum(float *ptr, int length);
    void wavecorr();
    QString correlationAnalysis(float r);
    float Correlationcoefficient(float *ptr1, float *ptr2, int length);
protected:
    void keyPressEvent(QKeyEvent *event);

public slots:
    void horizontalMove(int a);
    void openfile();
    void readFirstPage();//򿪵һҳ
    void readPageUp();//һҳ
    void readPageDown();//һҳ
    void readLastPage();//һҳ
    void curZoomChange(int value);
    void specAnalysis();
    void phasic();

private:
    QToolBar *fileToolBar;
    QAction *fpageAction;//ҳ
    QAction *ppageAction;//ǰһҳ
    QAction *npageAction;//һҳ
    QAction *lpageAction;//һҳ
    QAction *openAction;
    QAction *fftAction;//Ƶͼ
    QAction *phasicAction;//λͼ

    QWidget *centralwidget;
    PaintPSegy *paint1;
    PaintPSegy *paint2;
    PaintPSegy *paint3;
    PaintPSegy *paint4;
    QScrollBar *horizontalScrollBar,*verticalScrollBar; //ˮƽ
    QVBoxLayout *verticalLayout;
    QHBoxLayout *horizontalLayout;
    QGridLayout *gridLayout;
    QComboBox *comboBox;
    QDateEdit *dayEdit;
    QTimeEdit *timeEdit;
    QLabel *label1,*label2,*label3;
    Common *comm;
    Config *config;
    int fileCount;
    long horizontalValue;
    int buchang;
    float curZoom;
    LONG pointNum;
    Channel *channel; //Ƶͼλͼ
    bool specShow; //
    int freq;
    QLabel *locationLabel1, *locationLabel2,*locationLabel3;
    float R12, R13, R34;
    float T12, T13, T34;
};

#endif // PSEGYVIEW_H
